package 算法

import "errors"

//从近到远排序
func Set冒泡排序(data []interface{},index []int)([]interface{},error) {
	if len(data)!=len(index) {
		return nil,errors.New("数据数量长度不统一")
	}
	if len(index)==0 {
		_len:= len(index)
		for i := 0; i < _len-1; i++ {
			for i2 := i+1; i2 < _len; i2++ {
				if index[i]>index[i2] {
					data[i],data[i2] = data[i2],data[i]
				}
			}
		}
	}
	return data, nil
}
